﻿<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
  <class name="EnetaMvc.Core.Domain.Common.User,EnetaMvc.Core" table="users">

    <id name="Id" column="user_id" type="long">
      <generator class="identity"/>
    </id>

    <property name="UserName" column="username" type="string" />
    <property name="Email" column="email" type="string" />
    <property name="LiveIdToken" column="windowslivetoken" type="string" />
    <property name="Locked" column="locked" type="bool" />

    <property name="FirstName" column="first_name" type="string" />
    <property name="LastName" column="last_name" type="string" />
    <property name="Description" column="description" type="string" />
    <property name="HomePage" column="homepage" type="string" />
    <property name="Address" column="address" type="string" />
    <property name="Phone" column="phone" type="string" />
    <property name="School" column="school" type="string" />
    <property name="FieldOfStudy" column="field_of_study" type="string" />
    <property name="Company" column="company" type="string" />
    <property name="JobTitle" column="job_title" type="string" />
    <property name="SendEventsEmails" column="send_events_mails" type="bool" />
    <property name="SendCommunityEmails" column="send_community_mails" type="bool" />

    <property name="ShowFirstName" column="show_first_name" type="bool" />
    <property name="ShowLastName" column="show_last_name" type="bool" />
    <property name="ShowAddress" column="show_address" type="bool" />
    <property name="ShowJobTitle" column="show_job_title" type="bool" />
    <property name="ShowEmail" column="show_email" type="bool" />
    <property name="ShowFieldOfStudy" column="show_field_of_study" type="bool" />
    <property name="ShowCompany" column="show_company" type="bool" />
    <property name="ShowSchool" column="show_school" type="bool" />
    <property name="ShowPhone" column="show_phone" type="bool" />

    <property name="Created" column="created" type="DateTime" />
    <property name="Modified" column="modified" type="DateTime" />

    <bag name="Blogs" table="blog">
      <key column="created_by_id" />
      <one-to-many class="EnetaMvc.Core.Domain.News.Blog,EnetaMvc.Core" />
    </bag>
    <bag name="EventAttendings" table="event_attendee">
      <key column="user_id" />
      <one-to-many class="EnetaMvc.Core.Domain.Events.EventAttendee,EnetaMvc.Core" />
    </bag>
    <bag name="MyRoles" table="user_my_role">
      <key column="user_id" />
      <many-to-many class="EnetaMvc.Core.Domain.Common.MyRole,EnetaMvc.Core" column="my_role_id" />
    </bag>
    <bag name="Roles" table="user_role">
      <key column="user_id" />
      <many-to-many class="EnetaMvc.Core.Domain.Common.Role,EnetaMvc.Core" column="role_id" />
    </bag>
    <bag name="ModeratorOf" table="forum_moderator">
      <key column="user_id" />
      <many-to-many class="EnetaMvc.Core.Domain.Forums.Forum,EnetaMvc.Core" column="forum_id" />
    </bag>
  </class>
</hibernate-mapping>